Strict

Import agfx

Global myTmpScreen:TTmpScreen

Class TAgfx_test_app Extends TFramework


	

	Method OnCreate:Int()
		
		Super.OnCreate()
			
		'DISPLAY.SetVirtualSize(320,480)
		myTmpScreen = New TTmpScreen		
		myTmpScreen.Prepare()
		
		APP.graph_On = True
		
		Return 0
	End
	
End

Class MyBrushRelease Extends TCallback

	Field ref_br:TBrush

	Method New(b:TBrush)
		Self.ref_br = b
	End

	Method  Call:Void()
		'Self.ref_br.size = Rnd(1,16)
	End

End

Class TTmpScreen Extends TScreen
	
	Field brush:TBrush = New TBrush()
	
	' START when app is created
	Method Start:Void()
		Self.brush.SetSize(10,10)
		Self.brush.color.Set(255,255,255,255)	
		Self.brush.Enable()
		Self.brush.style = BRUSH_STYLE_SHARP
		Self.brush.OnRelease = New MyBrushRelease(Self.brush)
	End
	
	' main app logic loop update
	Method Update:Void()
		Self.brush.Update()

		If KeyHit(KEY_1) Then Self.brush.style = BRUSH_STYLE_ROUNDED
		If KeyHit(KEY_2) Then Self.brush.style = BRUSH_STYLE_HARD
		If KeyHit(KEY_3) Then Self.brush.style = BRUSH_STYLE_SHARP

		If KeyHit(KEY_4) Then 
			Self.brush.SetSize(4,12)
		End If

		If KeyHit(KEY_5) Then 
			Self.brush.SetSize(6)
		End If

		If KeyHit(KEY_6) Then 
			Self.brush.SetSize(12,4)
		End If
	End
	
	' main app render loop
	Method Render:Void()
		Cls
		Self.brush.Render()

		DrawText("[1] - ROUDED",1,10)
		DrawText("[2] - HARD",1,30)
		DrawText("[3] - SHARP",1,50) 

		DrawText("[4] - Size Start/End  > ",1,70) 
		DrawText("[5] - Size Start/End  = ",1,90) 
		DrawText("[6] - Size Start/End  < ",1,110) 
	End
End
